package jdk8.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

public class MapDemo {
    public static void main(String[] args) {
        List<User> userList = new ArrayList<>();
        userList.add(new User(1, 33));
        userList.add(new User(2, 30));
        userList.add(new User(3, 31));

        List newList=userList.stream().map(user -> user.getId()).collect(Collectors.toList());

        newList.stream().forEach(user->{
            System.out.println(user);
        });
    }
}
